package com.mall.product.controller;

import com.mall.common.utils.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope //配置中心修改自动刷新
@RestController
@RequestMapping("test")
public class TestController {

    @Value("${product.name}")
    private String name;

    /**
     *  获取配置中心值
     */
    @RequestMapping("/test")
    public R test(){
        return R.ok().put("name", name);
    }

}
